<?php
	include_once('header.php');
	if ($_SERVER['REQUEST_METHOD']=='POST') {
		$type_link = $_POST['link_select'];
		$type_comment = $_POST['comment_select'];
		$type_category = $_POST['category_select'];
		$type_cundang = $_POST['cundang_select'];
		$query_update_show_link = "update `setting` set `value`='".$type_link."' where `name`='show_link_sidebar'";
		$query_update_show_comment = "update `setting` set `value`='".$type_comment."' where `name`='show_comment_sidebar'";
		$query_update_show_category = "update `setting` set `value`='".$type_category."' where `name`='show_category_sidebar'";
		$query_update_show_cundang = "update `setting` set `value`='".$type_cundang."' where `name`='show_cundang_sidebar'";
		$mysql_connection->query($query_update_show_link);
		$mysql_connection->query($query_update_show_comment);
		$mysql_connection->query($query_update_show_category);
		$mysql_connection->query($query_update_show_cundang);
	}
?>
<div id="content_b">
	<div class="content_c" id="link_form_sidebar_setting">
	<form action="<?php echo $_SERVER['PHP_SELF'];?>?message_box=侧栏显示设定已经保存" method="post">
		<div class="align_center">链接显示设定</div>
		<?php $setting = get_setting($mysql_connection);?>
		<div class="align_center"><select class="width_select" name="link_select">
			<option id="zhengchang_select_link" value="zhengchang_select_link">正常</option>
			<option id="gundong_select_link" value="gundong_select_link">滚动</option>
			<option id="xialaliebiao_select_link" value="xialaliebiao_select_link">下拉列表</option>
		</select></div>
		<hr />
		<div class="align_center">侧栏评论显示设定</div>
		<div class="align_center"><select class="width_select" name="comment_select">
			<option id="zhengchang_select_comment" value="zhengchang_select_comment">正常</option>
			<option id="gundong_select_comment" value="gundong_select_comment">滚动</option>
		</select></div>
		<hr />
		<div class="align_center">侧栏分类显示设定</div>
		<div class="align_center"><select class="width_select" name="category_select">
			<option id="zhengchang_select_category" value="zhengchang_select_category">正常</option>
			<option id="xialaliebiao_select_category" value="xialaliebiao_select_category">下拉列表</option>
		</select></div>
		<hr />
		<div class="align_center">侧栏存档显示设定</div>
		<div class="align_center"><select class="width_select" name="cundang_select">
			<option id="zhengchang_select_cundang" value="zhengchang_select_cundang">正常</option>
			<option id="xialaliebiao_select_cundang" value="xialaliebiao_select_cundang">下拉列表</option>
		</select></div><hr />
		<input type="submit" value="保存设置" />
	</form></div>
	<script type="text/javascript">
		var type_show_link = "<?php echo $setting['show_link_sidebar'];?>";
		var type_show_comment = "<?php echo $setting['show_comment_sidebar'];?>";
		var type_show_category = "<?php echo $setting['show_category_sidebar'];?>";
		var type_show_cundang = "<?php echo $setting['show_cundang_sidebar'];?>";
		document.getElementById(type_show_link).selected = "selected";
		document.getElementById(type_show_comment).selected = "selected";
		document.getElementById(type_show_category).selected = "selected";
		document.getElementById(type_show_cundang).selected = "selected";
	</script>
</div>
<?php include_once('footer.php');?>
